home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Periodicals / develop / develop 4 code / A⁄ROSE / MCPMBƒ / Exercise.r < prev    next >
Encoding:
Text File  |  1990-08-27  |  5.3 KB  |  275 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Exercise.r
  4. #
  5. #    derived from MPW 3.1's "Sample", a MultiFinder-Aware Simple Sample Application
  6. #
  7. #   Demonstrates how to use A/ROSE tasks for parallel processing 
  8. #    (one more program which computes Mandelbrot sets ...)
  9. #   
  10. #   One resizeable window; allows to select zoom-in rectangle
  11. #   (was meant to be an introductory Macintosh C-programming exercise, originally)
  12. #
  13. #   Refer to the original source code in the MPW CExamples folder for more comments
  14. #
  15. #    Components:
  16. #                Exercise.c
  17. #                Exercise.r
  18. #                Exercise.h
  19. #                Exercise.make
  20. #
  21. ------------------------------------------------------------------------------*/
  22.  
  23.  
  24. #include "Types.r"
  25.  
  26. #include "Exercise.h"
  27.  
  28.  
  29.  
  30. resource 'MBAR' (rMenuBar, preload) {
  31.     { mApple, mFile, mEdit};
  32. };
  33.  
  34.  
  35. resource 'MENU' (mApple, preload) {
  36.     mApple, textMenuProc,
  37.     AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
  38.     enabled, apple,
  39.     {
  40.         "About Exercise…",
  41.             noicon, nokey, nomark, plain;
  42.         "-",
  43.             noicon, nokey, nomark, plain
  44.     }
  45. };
  46.  
  47. resource 'MENU' (mFile, preload) {
  48.     mFile, textMenuProc,
  49.     MenuItem5,                /* enable Quit only, program enables others */
  50.     enabled, "File",
  51.     {
  52.         "New",
  53.             noicon, "N", nomark, plain;
  54.         "Open",
  55.             noicon, "O", nomark, plain;
  56.         "-",
  57.             noicon, nokey, nomark, plain;
  58.         "Close",
  59.             noicon, "W", nomark, plain;
  60.         "-",
  61.             noicon, nokey, nomark, plain;
  62.         "Reset",
  63.             noicon, "R", nomark, plain;
  64.         "-",
  65.             noicon, nokey, nomark, plain;
  66.         "Quit",
  67.             noicon, "Q", nomark, plain
  68.     }
  69. };
  70.  
  71. resource 'MENU' (mEdit, preload) {
  72.     mEdit, textMenuProc,
  73.     NoItems,                /* disable everything, program does the enabling */
  74.     enabled, "Edit",
  75.      {
  76.         "Undo",
  77.             noicon, "Z", nomark, plain;
  78.         "-",
  79.             noicon, nokey, nomark, plain;
  80.         "Cut",
  81.             noicon, "X", nomark, plain;
  82.         "Copy",
  83.             noicon, "C", nomark, plain;
  84.         "Paste",
  85.             noicon, "V", nomark, plain;
  86.         "Clear",
  87.             noicon, nokey, nomark, plain
  88.     }
  89. };
  90.  
  91.  
  92.  
  93. /* this ALRT and DITL are used as an About screen */
  94.  
  95. resource 'ALRT' (rAboutAlert, purgeable) {
  96.     {40, 20, 160, 300},
  97.     rAboutAlert,
  98.     { /* array: 4 elements */
  99.         /* [1] */
  100.         OK, visible, silent,
  101.         /* [2] */
  102.         OK, visible, silent,
  103.         /* [3] */
  104.         OK, visible, silent,
  105.         /* [4] */
  106.         OK, visible, silent
  107.     }
  108. };
  109.  
  110. resource 'DITL' (rAboutAlert, purgeable) {
  111.     { /* array DITLarray: 5 elements */
  112.         /* [1] */
  113.         {88, 190, 108, 270},
  114.         Button {
  115.             enabled,
  116.             "OK"
  117.         },
  118.         /* [2] */
  119.         {8, 8, 24, 290},
  120.         StaticText {
  121.             disabled,
  122.             "A/ROSE parallel processing exercise"
  123.         },
  124.         /* [3] */
  125.         {32, 8, 48, 290},
  126.         StaticText {
  127.             disabled,
  128.             "(derived from MPW:CExamples:Sample)"
  129.         },
  130.         /* [4] */
  131.         {56, 8, 72, 136},
  132.         StaticText {
  133.             disabled,
  134.             "Brought to you by:"
  135.         },
  136.         /* [5] */
  137.         {80, 24, 112, 167},
  138.         StaticText {
  139.             disabled,
  140.             "Joseph Maurer (EURO.DTS)"
  141.         }
  142.     }
  143. };
  144.  
  145.  
  146. /* this ALRT and DITL are used as an error screen */
  147.  
  148. resource 'ALRT' (rUserAlert, purgeable) {
  149.     {40, 20, 160, 280},
  150.     rUserAlert,
  151.     { /* array: 4 elements */
  152.         /* [1] */
  153.         OK, visible, silent,
  154.         /* [2] */
  155.         OK, visible, silent,
  156.         /* [3] */
  157.         OK, visible, silent,
  158.         /* [4] */
  159.         OK, visible, silent
  160.     }
  161. };
  162.  
  163.  
  164. resource 'DITL' (rUserAlert, purgeable) {
  165.     { /* array DITLarray: 3 elements */
  166.         /* [1] */
  167.         {80, 150, 100, 230},
  168.         Button {
  169.             enabled,
  170.             "OK"
  171.         },
  172.         /* [2] */
  173.         {10, 60, 60, 230},
  174.         StaticText {
  175.             disabled,
  176.             "^0."
  177.         },
  178.         /* [3] */
  179.         {8, 8, 40, 40},
  180.         Icon {
  181.             disabled,
  182.             2
  183.         }
  184.     }
  185. };
  186.  
  187. resource 'STR ' (rTaskName, purgeable) {
  188.  "MBTask"
  189. };
  190.  
  191. resource 'STR ' (rTaskType, purgeable) {
  192.  "MBServer"
  193. };
  194.  
  195. resource 'STR ' (rClientName, purgeable) {
  196.  "ClientApp"
  197. };
  198.  
  199. resource 'STR ' (rClientType, purgeable) {
  200.  "ClientType"
  201. };
  202.  
  203.  
  204. resource 'STR#' (rErrStrings, purgeable) {
  205.     {
  206.     "You must run on 512Ke or later";
  207.     "Application Memory Size is too small";
  208.     "Not enough memory to run TaskSample";
  209.     "Cannot create window";
  210.     "Cannot use A/ROSE Prep";
  211.     "Task already registered";
  212.     "<GetMsg> failed";
  213.     "No Server task found";
  214.     "Problem with ICC Manager";
  215.     "Received message with unknown mCode";
  216.     "Received undeliverable message";
  217.     "Cannot allocate BitMap";
  218.     }
  219. };
  220.  
  221.  
  222. resource 'WIND' (rWindow, preload, purgeable) {
  223.     {50, 50, 210, 210},
  224.     documentProc, visible, noGoAway, 0x0, "Exercise"
  225. };
  226.  
  227.  
  228. resource 'CNTL' (rCPUchk, "CPU  - lines") {
  229.     {160-kBottom+8, kBord, 160-kBottom+24, kBord+kCntPos},
  230.     0,
  231.     visible,
  232.     1,
  233.     0,
  234.     checkBoxProc,
  235.     0,
  236.     "CPU - lines"
  237. };
  238.  
  239. resource 'CNTL' (rMCPchk, "MCP - lines") {
  240.     {160-kBottom+24, kBord, 160-kBottom+40, kBord+kCntPos},
  241.     0,
  242.     visible,
  243.     1,
  244.     0,
  245.     checkBoxProc,
  246.     0,
  247.     "MCP - lines"
  248. };
  249.  
  250.  
  251.  
  252. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  253.  
  254. resource 'SIZE' (-1) {
  255.     dontSaveScreen,
  256.     acceptSuspendResumeEvents,
  257.     enableOptionSwitch,
  258.     canBackground,                /* we can background; we don't currently, but our sleep value */
  259.                                 /* guarantees we don't hog the Mac while we are in the background */
  260.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  261.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  262.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  263.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  264.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  265.     reserved,
  266.     reserved,
  267.     reserved,
  268.     reserved,
  269.     reserved,
  270.     reserved,
  271.     reserved,
  272.     kPrefSize * 1024,
  273.     kMinSize * 1024    
  274. };
  275.